package com.tiwi.gmbdr.tools;

import java.util.ArrayList;
import java.util.List;

public class Tool {

	
	
	
	public static String[] split(String original, String delimeter) {
		List<String> nodes = splitToVector(original, delimeter);

		String[] result = new String[nodes.size()];
		if (nodes.size() > 0) {
			for (int loop = 0; loop < nodes.size(); loop++) {
				result[loop] = (String) nodes.get(loop);
			}
		}

		return result;
	}
	
	public static List<String> splitToVector(String original, String delimeter) {
		List<String> nodes = new ArrayList<String>();
		int index = original.indexOf(delimeter);

		while (index >= 0) {
			nodes.add(original.substring(0, index));
			original = original.substring(index + delimeter.length());
			index = original.indexOf(delimeter);
		}

		nodes.add(original);

		return nodes;
	}
}
